<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>

    <style>
      header {
        width: 375px;
        height: 60px;
        background-color: #e54847;
        text-align: center;
        line-height: 60px;
        color: #fff;
        position: relative;
      }

      .icon-wrap {
        position: absolute;
        right: 20px;
        top: 50%;
        transform: translateY(-50%);
      }
    </style>
  </head>
  <body>
    <div id="app">
      <maoyan-header>
        <template #title><span>猫眼电影</span></template>
        <template #icon><span>🍉</span></template>
      </maoyan-header>
    </div>

    <script src="./lib/vue3.js"></script>
    <script>
      const { createApp } = Vue;

      const MaoyanHeader = {
        template: `
          <header>
            <slot name="title"></slot>

            <div class="icon-wrap">
              <slot name="icon"></slot>
            </div>
          </header>
        `,
      };

      createApp({
        data() {
          return {};
        },
        components: {
          MaoyanHeader,
        },
      }).mount("#app");
    </script>
  </body>
</html>
